package com.app.backend.password.check.service.impl;

import com.app.backend.common.utils.AesEncryptUtil;
import com.app.backend.password.check.aop.DecryptType;
import com.app.backend.password.check.service.DecryptService;
import com.app.backend.password.check.vo.DecryptParamBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author: ZhengJunJie
 * @Date: 2020/6/12 12:10
 */
@Slf4j
@DecryptType(name = "Aes")
@Service
public class AesDecryptServiceImpl implements DecryptService {

    DecryptParamBean bean;

    @Override
    public void setParams(DecryptParamBean bean) {
        this.bean = bean;
    }

    @Override
    public String doDecrypt(DecryptParamBean bean) {
        return AesEncryptUtil.decryptByBase64(bean.getContent(), bean.getAesKey(), bean.getIvParameter());
    }
}
